const fs = require("fs");
const path = require("path");
const fullPath = path.resolve(__dirname, "./data.txt");

const opt = {
  flags: "a", // 追加写入，覆盖 w （注意 flags）
};

// 流式写入
const ws = fs.createWriteStream(fullPath, opt);
ws.write("流式写入\n");
